<template>
  <a-tabs style="width: 100%">
    <a-tab-pane tab="设计工具" force-render>
      <a-tabs v-model:activeKey="activeKey" @change="changeFun">
        <a-tab-pane key="1" tab="设计工具列表" force-render>
          <p style="padding: 5px; font-size: 15px; font-weight: 600">请选择设计仿真工具</p>
          <a-collapse v-model:activeKey="activeNum" ghost>
            <a-collapse-panel key="1" header="设计仿真工具">
              <div class="item-box flex-box">
                <!-- v-if="list && list.length > 0" v-for="item in list" :key="item.id" -->
                <div class="item-view">
                  <p class="time-view">
                    <i class="el-icon-alarm-clock"></i>
                    剩余小时
                    <!-- {{ (item.residueTiming / 60).toFixed(2) }} -->
                  </p>
                  <div class="design-info">
                    <div class="img-view">
                      <div style="width: 60px; height: 60px"></div>
                    </div>
                    <p class="name-view">
                      <span class="applic-view-name">测试</span>
                      <!-- {{ item.name }} -->
                    </p>
                  </div>
                  <div class="flex-box but-group">
                    <p class="open-btn">打开</p>
                    &ensp;&ensp;
                    <!-- @click.stop="onOpenApplication(item)" -->
                    <p class="renew-btn" @click.stop="onRenewOpen()">续费</p>
                  </div>
                </div>
                <!-- 占位符 -->
                <div class="item-view view-hidden"></div>
                <div class="item-view view-hidden"></div>
                <div class="item-view view-hidden"></div>
                <div class="item-view view-hidden"></div>
                <div class="item-view view-hidden"></div>
              </div>
            </a-collapse-panel>
          </a-collapse>
        </a-tab-pane>
        <a-tab-pane key="2" tab="会话列表" force-render>
          <BaseTablePagination :columns="columns" :toolbar="{ isTabbar: false }" :table-data="tableData">
            <template #actionColumn="{ scope }">
              <a-button type="link" @click.stop="onDetails(scope.row)">详情</a-button>
            </template>
          </BaseTablePagination>
        </a-tab-pane>
      </a-tabs>
    </a-tab-pane>
  </a-tabs>
  <onRenew ref="refTestComponentPdk" />
</template>
<script setup lang="ts">
import { defineProps } from "vue"
import onRenew from "@/components/Business/XTModuleFormEDA/XTModuleEDAApplyCost.vue"
import BaseTablePagination from "@/components/Basics/BaseTablePagination.vue"
const activeKey = ref("1")
const activeNum = ref(1)
/*窗口点击改变事件*/
const changeFun = () => {
  console.log(activeKey)
}
const refTestComponentPdk = ref()
const onRenewOpen = () => {
  refTestComponentPdk.value.visibleHide()
}
const columns = reactive([
  { title: "会话Id", dataIndex: "id", key: "id" },
  { title: "会话名", dataIndex: "name", key: "name" },
  { title: "会话所属者", dataIndex: "owner", key: "owner" },
  { title: "状态", dataIndex: "statusText", key: "statusText" },
  { title: "所有者", dataIndex: "owner", key: "owner" },
  { title: "操作系统", dataIndex: "os", key: "os" },
  { title: "是否共享", dataIndex: "isShareText", key: "isShareText" },
  { title: "执行节点", dataIndex: "host", key: "host" },
  { title: "启动模式", dataIndex: "startmode", key: "startmode" },
  { title: "启动时间", dataIndex: "createDate", key: "createDate" },
  { title: "运行时长", dataIndex: "runTime", key: "runTime" },
  { title: "空闲时间", dataIndex: "freeTime", key: "freeTime" },
  { title: "操作", dataIndex: "action", align: "center", width: 240, fixed: "right" },
])
const tableData = reactive([])
const onDetails = (row: any) => {
  console.log(row)
}
defineProps({
  list: {
    type: Array,
    default: () => [],
  },
})
</script>
<style scoped lang="less">
.item-box {
  padding: 0 30px;
  justify-content: space-between;
  flex-wrap: wrap;
  .view-hidden {
    visibility: hidden;
  }
  .item-view {
    position: relative;
    .time-view {
      position: relative;
      top: -4px;
      text-align: left;
      text-indent: 7px;
    }
    margin: 10px;
    height: 255px;
    width: 210px;
    border: 1px solid rgb(102, 102, 102);
    padding: 10px 0;
    text-align: center;
    color: orange;
    cursor: pointer;
    box-sizing: border-box;
    border-top: 4px solid rgb(102, 102, 102);
    transition: box-shadow 0.5s;
    &:hover {
      box-shadow: rgb(0 0 0 / 10%) 0px 2px 12px 0px;
      // background: #eee;
    }
    .design-info {
      position: relative;
      height: 180px;
      p {
        padding: 10px 0;
        box-sizing: border-box;
      }
      span {
        color: black;
        font-weight: bold;
      }
    }
    .but-group {
      justify-content: space-around;
      p {
        display: inline-block;
        width: 65px;
        height: 28px;
        line-height: 28px;
        border-radius: 5px;
        color: #fff;
        box-sizing: border-box;
        font-size: 12px;
        cursor: pointer;
        &.renew-btn {
          background-color: #f95f02;
          transition: background 0.5s;
          &:hover {
            background: #e43b3b;
          }
        }
        &.open-btn {
          background-color: #0255c8;
          transition: background 0.5s;
          &:hover {
            background: #0a6bf1;
          }
        }
      }
    }
  }
}
</style>
